package cn.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 自定义数据测试(DateConvert和DateFormatter)
 */
@RestController
@RequestMapping("customer")
public class CustomerController {

    @RequestMapping("/date/convert")
    public String dateConvert(Date date) {
        return "dateConvert : " + date.toString();
    }

    /**
     * 注:中间的"%20"是空格,在url中会进行转义为"%20"
     * <p>
     * 浏览器访问 http://localhost:8080/customer/date/convert?date=2022-04-05%2023:33:59
     * 网页 "dateConvert : Tue Apr 05 23:33:59 CST 2022"
     */

    @RequestMapping("/date/formatter")
    public String dateFormatter(Date date) {
        return "dateFormatter : " + date.toString();
    }
    /**
     * 注:中间的"%20"是空格,在url中会进行转义为"%20"
     *
     * 浏览器访问 http://localhost:8080/customer/date/formatter?date=2022-04-05%2023:33:59
     * 网页 "dateFormatter : Tue Apr 05 23:33:59 CST 2022"
     */
}
